UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4I0+79pTN7t8VaWxw3EnceccslV2LTDGf+5Vedhofec=' 
WHERE 
  key_id = 'a182e56341e863d4589df841e6a32c756429aae1bfca76808d9045669bde6cbd' 
  AND (
    token = '4I0+79pTN7t8VaWxw3EnceccslV2LTDGf+5Vedhofec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035