UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YSAfSbqgVrUzcKVqWitpa+uUNeAXt6lbFNV2zctug6o=' 
WHERE 
  key_id = 'c1ae9d03c4ccdb7b5b5aaa72eb9ed197c9e028a169ad2a1d60b6111cdb0f97c4' 
  AND (
    token = 'YSAfSbqgVrUzcKVqWitpa+uUNeAXt6lbFNV2zctug6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041