UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TnNrtlbam8lC/qYo58ZPU9vM1FXgNA6xtPJxulC90Kc=' 
WHERE 
  key_id = 'a502d60580a8c3cff120ec8ebef07e26efd798aa0ce5f7899333ad4b83a96454' 
  AND (
    token = 'TnNrtlbam8lC/qYo58ZPU9vM1FXgNA6xtPJxulC90Kc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062