UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't6vlSghSAXc1bucCiPev8F5teA0c6gV9bMlg28IJbv0=' 
WHERE 
  key_id = '4a5a2b73455b2f34da8befa72c9b1178dbc44fe209cdb7c09b0d96ad1c28943c' 
  AND (
    token = 't6vlSghSAXc1bucCiPev8F5teA0c6gV9bMlg28IJbv0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019