UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wtldbiLGLFPlwF1PWTpKqTA3qO7ARL+pDXGaKc6Ssxk=' 
WHERE 
  key_id = '2a8509411ced4e08e4ed53a6aff30494d9c8e1ecd26d72e7f528e715d91841d2' 
  AND (
    token = 'wtldbiLGLFPlwF1PWTpKqTA3qO7ARL+pDXGaKc6Ssxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038