UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vmsM22aUP3QFPX77QISght47wH58FdvPouqY9NZ0uok=' 
WHERE 
  key_id = '25de19a8c74817b807daa8e09f8a7d98017b5175ca2a2d9502922a156714739f' 
  AND (
    token = 'vmsM22aUP3QFPX77QISght47wH58FdvPouqY9NZ0uok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054