UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o7i0kF57mMtmsHXVBsf0EyY2lchRlZzrrCs4pMfK+CE=' 
WHERE 
  key_id = '1f63ef50078d6f703d5aa4d554134b3c0d9e6bdb2cda300741edf7a69460c8c7' 
  AND (
    token = 'o7i0kF57mMtmsHXVBsf0EyY2lchRlZzrrCs4pMfK+CE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041