UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1lews7+BvNruAdeRdD+/9AbHiCTkeapTneZZQA4RoXI=' 
WHERE 
  key_id = 'fb8d0d26264a8e392730f447144cd17a636aacf18fd12d806ada703192b9b5eb' 
  AND (
    token = '1lews7+BvNruAdeRdD+/9AbHiCTkeapTneZZQA4RoXI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042