UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pl39ZoY6xdpTI1a/XanKYQcj8C7COpU2+oDzpDfDBh4=' 
WHERE 
  key_id = '4af183d69ec3a61e337dff05993f232389b42417ad256428224d64e3288e3e16' 
  AND (
    token = 'Pl39ZoY6xdpTI1a/XanKYQcj8C7COpU2+oDzpDfDBh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025