UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6lkOvdFC1RmE0LNit1E7dJJzTsdibGLqw5x7QopR2cs=' 
WHERE 
  key_id = '1668a1264baa52ff69d8e2c4a27173e4c304dbd6ca40ea86f25a8f981047ec8b' 
  AND (
    token = '6lkOvdFC1RmE0LNit1E7dJJzTsdibGLqw5x7QopR2cs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028