UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NZ7ipqv8h9/jjFGkArbYGbsfeL6G3eOvHwfsaEaRX70=' 
WHERE 
  key_id = '7ed65743db38d50deaeb50ace25e9d553928bd32324808e6635a46a403c38460' 
  AND (
    token = 'NZ7ipqv8h9/jjFGkArbYGbsfeL6G3eOvHwfsaEaRX70=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033