UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KkcfgddKNos1PUq0vbSs1phykPKldZXx6lgaV22mES8=' 
WHERE 
  key_id = '4ad6cfe1b11a0289b8d87f8593ea0d0314307db71f517636b0708d9f13b8e04f' 
  AND (
    token = 'KkcfgddKNos1PUq0vbSs1phykPKldZXx6lgaV22mES8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030