UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N/XzluGQ1IP7hOLrsbVLDwOyUPUZNAlpjZW/Qw1KYuc=' 
WHERE 
  key_id = '516d428c381a13cfdf66176ef59b8b8e433db55c104cb87c44605d547214ec50' 
  AND (
    token = 'N/XzluGQ1IP7hOLrsbVLDwOyUPUZNAlpjZW/Qw1KYuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042