UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ck4dnYpb0oAILbdO/Gq2RSYEFhJurhuVg9QfyD4B4+I=' 
WHERE 
  key_id = '6772f533bf109125d3032aaee64a52655f27f245dc47e116b85c7c01ab5a359b' 
  AND (
    token = 'Ck4dnYpb0oAILbdO/Gq2RSYEFhJurhuVg9QfyD4B4+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047