UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BeszHopoVNLpnM85wqMDlL/OuvsOIgQq5Ap+0KZLI4o=' 
WHERE 
  key_id = '162e2461be130e25799c1af759ed97e7db29b2c91d471d0e24c54d381b30732f' 
  AND (
    token = 'BeszHopoVNLpnM85wqMDlL/OuvsOIgQq5Ap+0KZLI4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049