UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sb3poEt9CAVYwkjKmCYv61/pwYzbAC0XZaddo+n02lM=' 
WHERE 
  key_id = 'dbb113003b84bfdcc51150adad7c908262c27e26f705c8cc2d13579837b0e801' 
  AND (
    token = 'sb3poEt9CAVYwkjKmCYv61/pwYzbAC0XZaddo+n02lM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028