UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WCtIfkYBSkV1Ot72CsxSrrcXvbnzYcU5ivzbjSgpz/4=' 
WHERE 
  key_id = 'd08ad2244476f5a7a445980feb8c1b79fbff36805781027fdf94ff4c2e5a43ab' 
  AND (
    token = 'WCtIfkYBSkV1Ot72CsxSrrcXvbnzYcU5ivzbjSgpz/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030