UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lPY1i2rOtEw9uR79wKiSFS9uHdo6tCfP+GiV+fjyAw4=' 
WHERE 
  key_id = 'b87f9caa0c140b52a50462ccc252c7446efb694f823adee76f415e2eb87a1c74' 
  AND (
    token = 'lPY1i2rOtEw9uR79wKiSFS9uHdo6tCfP+GiV+fjyAw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050