UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MZDpbDtBPOfl52pI9E4noZN+y/bEgr0ZA92J3cXTn2Q=' 
WHERE 
  key_id = '38ba5d33dde204f65aa657883945e595dd52f7736cf46c5f79cdd3ef0cc059ef' 
  AND (
    token = 'MZDpbDtBPOfl52pI9E4noZN+y/bEgr0ZA92J3cXTn2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047