UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+Dq3FK+XrJgPMlhXe9RTRKJ7TGMlaQ9KWSUH1rEK3Q=' 
WHERE 
  key_id = 'ed29022b497df4e7f27f9733729694571e350db91ed1ca53320b0d6ccc95852b' 
  AND (
    token = 'B+Dq3FK+XrJgPMlhXe9RTRKJ7TGMlaQ9KWSUH1rEK3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028