UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xWOBfXXyqyIqyIu1l4jr3mFEk1frV0tj4eqsFWxW4UQ=' 
WHERE 
  key_id = '6b071cc7112a4e7cbd0329b685b4d904b1f229fb669fc09e924f655a77270552' 
  AND (
    token = 'xWOBfXXyqyIqyIu1l4jr3mFEk1frV0tj4eqsFWxW4UQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041