UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oqj6lPJKe83HdgyrGeJUrru+RxuZ56zczygVaDw8n08=' 
WHERE 
  key_id = 'dd84c72bdecc883f22c2c7a11941ede7aa060b162e9799b70ba5f9b215bbc17d' 
  AND (
    token = 'oqj6lPJKe83HdgyrGeJUrru+RxuZ56zczygVaDw8n08=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045