UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'stoRK/0G0tYrJrPscV7hWwczkG1c/B5peqUb+Nx171s=' 
WHERE 
  key_id = 'bb3b2ce94bbac4b74cee73016eb21681c33a052328a39f5f927aaaa56c5498eb' 
  AND (
    token = 'stoRK/0G0tYrJrPscV7hWwczkG1c/B5peqUb+Nx171s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050