UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wr838LGqXUgBU8U6boJFP/XLycXdLZsTbTfCaId4b5E=' 
WHERE 
  key_id = '31ca8f7fa99a9b6276dfa56b10c9be1369e4bf6fc9e117574bc8882567142821' 
  AND (
    token = 'Wr838LGqXUgBU8U6boJFP/XLycXdLZsTbTfCaId4b5E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033