UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kp+G7B8QOhD/qMp8gyT3HHoxxvdLE4P4jPLF2NWbDcs=' 
WHERE 
  key_id = 'd245d467e1e35d3503a64f1d98d2d95136a7f3b023d530e47a1e96979bc31743' 
  AND (
    token = 'Kp+G7B8QOhD/qMp8gyT3HHoxxvdLE4P4jPLF2NWbDcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023