UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C7xZ3Ic1Vk9qtReI0GZWyF05tNPTBtDH9QGDaYi1RV8=' 
WHERE 
  key_id = '24b54736bf663ad4447740adc302e4b9b66858c2e915d0ffc25d147cafa434ca' 
  AND (
    token = 'C7xZ3Ic1Vk9qtReI0GZWyF05tNPTBtDH9QGDaYi1RV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055