UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'avakKE7psKYfirrfeFsKD/wxcwxvN3CUAoxut+GlFWc=' 
WHERE 
  key_id = 'a15e5fe4563957717fd5ee1f328446bc814e68f2a32157d0d59fc65d9afa73b3' 
  AND (
    token = 'avakKE7psKYfirrfeFsKD/wxcwxvN3CUAoxut+GlFWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039