UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y8NzR6SPEFbmbmNkZjhHggtP/97KBy34/y51vHA1b2A=' 
WHERE 
  key_id = '802c16d2cec7ba588905abb8667e51d4a15c811c906ba1a753803cd8ae366629' 
  AND (
    token = 'y8NzR6SPEFbmbmNkZjhHggtP/97KBy34/y51vHA1b2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034