UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GQkeW/4b4RM1mIgvUyvW7X0x51+pIh2Sk+QovCsNK6U=' 
WHERE 
  key_id = '2bd524e1c2bd5f2eedc8e91322e1063b018cda14d0262b820092464024687597' 
  AND (
    token = 'GQkeW/4b4RM1mIgvUyvW7X0x51+pIh2Sk+QovCsNK6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033