UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HQly35cWp2TrgYMKkFO0Cm9oxTn2Gw5nFQj8YfHLVUA=' 
WHERE 
  key_id = '6a31a4312a1a8305aa138a91d9fd33c992dc6c819e00f8a0d371d20c5a1a7772' 
  AND (
    token = 'HQly35cWp2TrgYMKkFO0Cm9oxTn2Gw5nFQj8YfHLVUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045