UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iGwXcHyqyZ4M1WEK01bmeRWA2U0c9nCqzqnjZwiBDAk=' 
WHERE 
  key_id = '1887ce1c95a478e8d7c2ac2959c44c92bd5bbd52b8a85ef19433e621b6b11964' 
  AND (
    token = 'iGwXcHyqyZ4M1WEK01bmeRWA2U0c9nCqzqnjZwiBDAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017