UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5KNKRmnX+M3moaqzI5v8xwoh4R7n+3ttRBKxltCBiQk=' 
WHERE 
  key_id = '171b1f9a4ce9cd5367b928855bd6521dcb78896a1ec9b9ee573dd0a726cbd00f' 
  AND (
    token = '5KNKRmnX+M3moaqzI5v8xwoh4R7n+3ttRBKxltCBiQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030