UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tQxXSY+9VOX3N5IlOK6cr+0JT/oq2KBIOuJWOmeBLoI=' 
WHERE 
  key_id = '5331e48e4d02898c048eabcf3f20d7148fc98207843ce1728f4ef0c1c09ec079' 
  AND (
    token = 'tQxXSY+9VOX3N5IlOK6cr+0JT/oq2KBIOuJWOmeBLoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039