UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xqbT7tTxN9kC1vPRD6RpJ1fTY7lNQoI0d6N1NcgbzVg=' 
WHERE 
  key_id = '52b0cf01e5ea00bc07476231f3e548382152bf0f389544c0f5bc0199f0eeeaeb' 
  AND (
    token = 'xqbT7tTxN9kC1vPRD6RpJ1fTY7lNQoI0d6N1NcgbzVg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028