UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CZ8b4pr+cqNsRUCpMRuSjSGLFCRFsATbNpjUkbD4Mik=' 
WHERE 
  key_id = '3108b52937ca80baa409b9307b40f0b078602c0139b265b4f3e59e41ef4356bd' 
  AND (
    token = 'CZ8b4pr+cqNsRUCpMRuSjSGLFCRFsATbNpjUkbD4Mik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031