UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jxKNegMcn2v2ffwvZKp+jPh/BTOpbrWZNI1ZyV+TLjE=' 
WHERE 
  key_id = '32dccc4fe6195d87ce6499156eb68d0087fbc2136ee0a5a7cc52688937ab6ea9' 
  AND (
    token = 'jxKNegMcn2v2ffwvZKp+jPh/BTOpbrWZNI1ZyV+TLjE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028